package com.gitee.xhs.iterateStream;

import com.gitee.xhs.dao.IterateTransaction;
import org.apache.flink.api.common.functions.MapFunction;

/**
 * @author BigHead
 * @date 2022/7/19 17:28
 * @description OperatorIterateLoopMap
 */
public class OperatorIterateLoopMap implements MapFunction<IterateTransaction, IterateTransaction> {
    @Override
    public IterateTransaction map(IterateTransaction value) throws Exception {
        value.setIterateLoopTimes(
                value.getIterateLoopTimes() + 1
        );
        value.getTransaction().setAmount(
                value.getTransaction().getAmount() - 1d
        );
        return value;
    }
}
